<template>
    <view class="page">
        <view v-html="detail"></view>
    </view>
</template>

<script>
    export default {
        name: "messageDetail",
        data(){
            return{
                messageId: '',
                detail:''
            }
        },
        onLoad(query){
            this.messageId = query.messageId;
            this.getMessageDetail()
        },
        methods:{
            //获取消息详情
            async getMessageDetail(){
                const res = await this.$api.getMessageDetail({id:this.messageId,user_token: uni.getStorageSync('userToken')});
                if (res.data.level == 'success'){
                    let str = res.data.data.detail;
                    str = str.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
                    this.detail = str;
                }
            }
        }
    }
</script>

<style scoped lang="scss">
    .page{
        padding: 30rpx;
    }
</style>